/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. All rights reserved.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef AICL_UTILS_H
#define AICL_UTILS_H
#include <fstream>
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#include <vector>


#define INFO_LOG(fmt, args...) fprintf(stdout, "[INFO] " fmt "\n", ##args)
#define DEBUG_LOG(fmt, args...) fprintf(stdout, "[DEBUG] " fmt "\n", ##args)
#define WARN_LOG(fmt, args...) fprintf(stdout, "[WARN] " fmt "\n", ##args)
#define ERROR_LOG(fmt, args...) fprintf(stderr, "[ERROR]  " fmt "\n", ##args)

class RunStatus {
public:
    static void SetDeviceStatus(bool isDevice)
    {
        isDevice_ = isDevice;
    }
    static bool GetDeviceStatus()
    {
        return isDevice_;
    }

private:
    RunStatus() = default;
    ~RunStatus() = default;
    static bool isDevice_;
};

typedef enum Result {
    OPENCANN_SUCCESS = 0,
    OPENCANN_FAILED = -1
} Result;


/**
 * Utils
 */
class Utils {
public:
    /* *
     * @brief create device buffer of file
     * @param [in] fileName: file name
     * @param [out] fileSize: size of file
     * @return device buffer of file
     */
    static void *GetDeviceBufferOfFile(std::string fileName, uint32_t &fileSize);

    /* *
     * @brief create buffer of file
     * @param [in] fileName: file name
     * @param [out] fileSize: size of file
     * @return buffer of pic
     */
    static void *ReadBinFile(std::string fileName, uint32_t &fileSize);

};

#endif
